using System;
using System.Collections.Generic;
using System.Text;

namespace CaseData {
    public class CaseDataView : System.Data.DataView {
        private CaseStatus m_status;
        public CaseDataView ( CaseStatus status, CaseBase.CaseItemDataTable table ):base(table) {
            m_status = status;
            this.RowFilter = ""; //Call rowfilter to get default filtering
        }

        
        public override string RowFilter {
            get { return base.RowFilter; }
            set {
                string m_filter = "";
                if( m_status != CaseStatus.All ) //No default filter for AllCases
                    m_filter = "CaseStatusId = '" + (int) m_status + "' AND ";
                m_filter += @"( CustomerName LIKE '%" + value + "%' ";
                m_filter += " OR Description LIKE '%" + value + "%' ";
                m_filter += " OR TicketId LIKE '%" + value + "%' ";
                m_filter += " OR ComplaintId LIKE '%" + value + "%' ";
                m_filter += ")";
                base.RowFilter = m_filter;
            }
        }
    }
}
